Skip to content

Add Cmd+Shift+Enter to insert a node before the current one#304

Open
johannesmutter wants to merge 2 commits into
mainfrom
cmd-shift-enter-insert-before
Open

Add Cmd+Shift+Enter to insert a node before the current one#304
johannesmutter wants to merge 2 commits into
mainfrom
cmd-shift-enter-insert-before

Conversation

@johannesmutter

@johannesmutter johannesmutter commented May 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds Cmd/Ctrl + Shift + Enter shortcut that behaves like Enter, but inserts the new node before the current node instead of after.
  • New transform insert_default_node_before and command InsertDefaultNodeBeforeCommand are added alongside the existing insert_default_node / InsertDefaultNodeCommand.
  • Only active on text selections, where "the current node" is well defined; node carets are ignored (which mirrors Enter's fallback structure).

Test plan

  • Place the caret inside a paragraph and press Cmd+Shift+Enter (or Ctrl+Shift+Enter on non-mac); a new empty default node appears before the current node, with the caret in the new node.
  • Original node's content is unchanged (no text splitting, unlike Enter).
  • Works at the beginning, middle, and end of the text.
  • Works inside nested node arrays (e.g. list items).
  • Plain Enter and Shift+Enter continue to behave as before.

🤖 Generated with Claude Code

Mirrors Enter (which inserts a new default node after the current
node) but places the new node before it. Only triggers on text
selections, where "the current node" is well defined.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@vercel

vercel Bot commented May 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
svedit Ready Ready Preview, Comment May 29, 2026 11:19am

In a node gap, "the current node" is the node above the caret. Insert
at offset - 1 (before that node). No-op when the caret is at offset 0
since there is no node above to insert before.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant